import { createRouter, createWebHistory } from 'vue-router'

const routes = [
  {
    path: '/',
    redirect:"/home",
  },
  {
    path: '/index',
    name: 'Index',
    component: () => import('../views/index/index.vue'),
    children:[
      {
        path: '/home',
        name: 'Home',
        component: () => import('../views/home/home.vue')
      },
      {
        path: '/user',
        name: 'User',
        component: () => import('../views/user/user.vue')
      },
      {
        path: '/article',
        name: 'Article',
        component: () => import('../views/article/article.vue')
      },
      {
        path: '/book',
        name: 'book',
        component: () => import('../views/book/book.vue')
      },
      {
        path: '/star',
        name: 'star',
        component: () => import('../views/star/star.vue')
      },
      {
        path: '/video',
        name: 'video',
        component: () => import('../views/video/video.vue')
      },
      {
        path: '/jietu',
        name: 'jietu',
        component: () => import('../views/jietu/jietu.vue')
      },
      {
        path: '/waterfall',
        name: 'waterfall',
        component: () => import('../views/waterfall/waterfall.vue')
      },
      {
        path: '/upload',
        name: 'upload',
        component: () => import('../views/upload/upload.vue')
      },
    ],
  },
  {
    path: '/login',
    name: 'Login',
    component: () => import('../views/login/login.vue')
  }
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
